package com.brainhealth.common.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * 订单支付状态
 */
public enum PayStatus implements BaseEnum
{
    Unpaid(0, "未支付"), Paid(1, "已支付"), Cancel(2, "已取消"), Refund(3, "已退款"), Failed(4, "失败"), Exercise(5, "训练中"), Finish(6, "已完成");
    private final int code;
    private final String info;

    PayStatus(int code, String info)
    {
        this.code = code;
        this.info = info;
    }

    public int getCode()
    {
        return code;
    }

    public String getInfo()
    {
        return info;
    }

    @Override
    public Integer getValue()
    {
        return code;
    }

    public static PayStatus getPayStatusByCode(int code)
    {
        for (PayStatus status : PayStatus.values()) {
            if (code==status.code){
                return status;
            }
        }
        return null;
    }

    public static String getPayStatusInfoByCode(int code)
    {
        for (PayStatus status : PayStatus.values()) {
            if (code==status.code){
                return status.info;
            }
        }
        return null;
    }


    public static List<Integer> getOrderStatus()
    {
        List<Integer> list = new ArrayList<>(3);
        list.add(Exercise.code);
        list.add(Finish.code);
        //全部
        list.add(-1);
        return list;
    }
}
